<?php
include( "inc/header.php" );
login_check( );

echo"<script type=\"text/javascript\">";
echo"function ShowMenu(MenuID) ";
echo"	{ ";
echo"	if(MenuID.style.display==\"none\") ";
echo"	{ ";
echo"	MenuID.style.display=\"\"; ";
echo"	} ";
echo"	else ";
echo"	{ ";
echo"	MenuID.style.display=\"none\"; ";
echo"	} ";
echo"	}";
echo"</script>";
echo"<body>";
echo"<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\"><tr><td>注：\"+\"为存在子目录，可以展开，\"-\"为终极分类.</td></tr></table><br/>";
global $db,$conn,$page,$classid,$intPerpage,$execc,$upfile,$webdir;
	$GLOBALS["id"] =1;
	$jibie=1; 
	$sql="select * from tun2_columns where bid=0  Order by columnswith desc,id asc"; 
	$result=mysql_query($sql,$Conn); 
	
	if(mysql_num_rows($result)>0)
	TreeMenu($Conn,$result,$jibie,$id); 
	
	function TreeMenu($Conn,$result,$jibie)  //进入函数循环
	{ 
	$numrows=mysql_num_rows($result); 
	echo "<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\">"; 
	for($rows=0;$rows<$numrows;$rows++) 
	{ 
	$menu=mysql_fetch_array($result); 
	$sql="select * from tun2_columns where bid=$menu[id]  Order by columnswith desc,id asc"; 
	$result_sub=mysql_query($sql,$Conn); 
	echo "<tr>"; 
		//如果该菜单项目有子菜单，则添加JavaScript onClick语句 
		if(mysql_num_rows($result_sub)>0) 
		{ 
		echo "<td width='20'><img src='images/+.gif' border='0'></td>"; 
		echo "<td class='Menu' >"; 
		} 
		else 
		{ 
		echo "<td width='20'><img src='images/-.gif' border='0'></td>"; 
		echo "<td class='Menu'>"; 
		} 
		if($menu[url]!="") 
		echo "<a href='$menu[url]'><span class=lmbt>$menu[columnsname]</span></a> "; 
		else 
		echo "<a href='#'><span class=lmbt onClick='javascript:ShowMenu(Menu".$GLOBALS["ID"].");'><font color=\"gray\" class=\"nob\">(id:$menu[id])</font> $menu[columnsname]";
				if ($menu[hide]==1)
								{
									echo "&nbsp;&nbsp;<font color=\"red\" class=\"nob\">隐</font>";
								}
		echo "</span></a>  <font color='orange'>";
		modulecolumns($menu[module]);
		echo "</font></span> ";
		echo"<span class=\"lmright\">";
		//查看
		if ($menu[module]==1){
		}elseif($menu[module]==6){
			echo "<a href=\"Admin_Book.php\">查看内容</a>"; 
		}else{
			echo "<a href=\"Admin_Content.php?Action=columns&columnsname={$menu[id]}\">查看内容</a>";  
		}
		//添加,当为留言模块时没有添加内容这一项
		if ($menu[module]!=6) {
			if (acl_check($menu['id'],0) || acl_check($menu['id'],1)) { //单页模块，表示有权限 修改内容 或 添加内容
				echo "<a href=\"";
				moduleurl($menu[module]);
				echo "{$menu[id]}\">";
				if (!empty($menu[content]) && $menu[module]==1) {
					echo "修改内容</a>";
				}else {
					echo "添加内容</a>";
				}
			}
			//echo "修改内容</a>";
		}
		if (acl_check($menu['id'],5)){
			echo "        <a href='Admin_Columns_set.php?Action=adds&bid={$menu[id]}'>添加子栏目</a> ";
		}
		if (acl_check($menu['id'],6)){
			echo " <a href='Admin_Columns_set.php?Action=edits&id=$menu[id]&bid=$menu[bid]'> 编辑栏目</a>";
		}
		if (acl_check($menu['id'],7)){
			echo "  <a href='Admin_Columns_Set.php?Action=del&id=$menu[id]' onClick=\"delcfm()\"> 删除栏目</a></span>"; 
		}
		echo "</td> </tr>"; 
		if(mysql_num_rows($result_sub)>0) 
		{ 
		//echo "<tr id=Menu".$GLOBALS["ID"]++." style='display:none'>"; 
		echo "<tr id=Menu".$GLOBALS["ID"]++." style='display:'>"; 
		echo "<td width='20'> </td>"; 
		echo "<td>"; 
		//将级数加1 
		$jibie++; 
		TreeMenu($Conn,$result_sub,$jibie); 
		$jibie--;
		echo "</td></tr>"; 
		} 
		//显示下一菜单
		} 
		echo "</table>"; 
} 
echo"</table>";
echo"</body> ";
echo"</html>";
?>